[HVM] Don't set the shadow allocation to zero if the dom is still shadowed.
authorTim Deegan <Tim.Deegan@xensource.com>
Tue, 2 Jan 2007 10:57:50 +0000 (10:57 +0000)
committerTim Deegan <Tim.Deegan@xensource.com>
Tue, 2 Jan 2007 10:57:50 +0000 (10:57 +0000)
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
xen/arch/x86/mm/shadow/common.c

index 8d9676b1595a48a9e4e1d9dcc82481873bc77793..fc68fd924288997fe6911a7e333f30f1d0997e15 100644 (file)
@@ -3306,6 +3306,15 @@ int shadow_domctl(struct domain *d,
 
     case XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION:
         shadow_lock(d);
+        if ( sc->mb == 0 && shadow_mode_enabled(d) )
+        {            
+            /* Can't set the allocation to zero unless the domain stops using
+             * shadow pagetables first */
+            SHADOW_ERROR("Can't set shadow allocation to zero, domain %u"
+                         " is still using shadows.\n", d->domain_id);
+            shadow_unlock(d);
+            return -EINVAL;
+        }
         rc = sh_set_allocation(d, sc->mb << (20 - PAGE_SHIFT), &preempted);
         shadow_unlock(d);
         if ( preempted )